//
//  ViewController.m
//  mosad_hw_fin
//
//  Created by student9 on 2020/12/24.
//  Copyright © 2020 student9. All rights reserved.
//

#import "ViewController.h"
#import "./model/headimageModel.h"
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    headimageModel *current_head_image = [headimageModel shareInstance];
    [current_head_image generateData];
    // Do any additional setup after loading the view, typically from a nib.
    self.window = [[UIWindow alloc]initWithFrame:[[UIScreen mainScreen]bounds]];
    self.view.backgroundColor = [UIColor whiteColor];
    UIImageView *imageV = [[UIImageView alloc] initWithFrame:CGRectMake(0-[UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height - 250, [UIScreen mainScreen].bounds.size.width, 250)];
    
    UILabel *myLabel= [[UILabel alloc]initWithFrame:CGRectMake([UIScreen mainScreen].bounds.size.width / 2 - 40,120,30,60)];
    myLabel.backgroundColor = [UIColor clearColor];
    myLabel.text = @"衣带渐宽终不悔";
    myLabel.font = [UIFont fontWithName:@"FZZJ-TJHWBJW"  size:(30)];
    myLabel.numberOfLines = 0;
    [myLabel sizeToFit];
    
    UILabel *myLabel2 = [[UILabel alloc]initWithFrame:CGRectMake([UIScreen mainScreen].bounds.size.width / 2 + 40,150,30,60)];
    myLabel2.backgroundColor = [UIColor clearColor];
    myLabel2.text = @"为伊消得人憔悴";
    myLabel2.font = [UIFont fontWithName:@"FZZJ-TJHWBJW"  size:(30)];
    myLabel2.numberOfLines = 0;
    [myLabel2 sizeToFit];
    
    imageV.image = [UIImage imageNamed:@"yindao.png"];
    [self.view addSubview:imageV];
    [self.view addSubview:myLabel];
    [self.view addSubview:myLabel2];
    [UIView animateWithDuration:1.5 animations:^{
        [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
        imageV.transform=CGAffineTransformMakeTranslation([UIScreen mainScreen].bounds.size.width, 0);
        myLabel.transform=CGAffineTransformMakeScale(1.2, 1.2);
        myLabel2.transform=CGAffineTransformMakeScale(1.3, 1.3);
    } completion:^(BOOL finished) {
        [myLabel2 removeFromSuperview];
        [myLabel removeFromSuperview];
        [imageV removeFromSuperview];
        [self gotoMain];
    }];
    
}

- (void) gotoMain {
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    UITabBarController  *tabBarVC = [[UITabBarController alloc] init];
    
    TodayViewController *todayVC = [[TodayViewController alloc]init];
    // 创建按钮
    UINavigationController *todayNav = [[UINavigationController alloc] initWithRootViewController:todayVC];
    todayNav.tabBarItem.title = @"日程";
    todayNav.tabBarItem.image = [[UIImage imageNamed:@"today.png"]TransformtoSize:CGSizeMake(28, 28)];
    todayNav.tabBarItem.selectedImage = [[UIImage imageNamed:@"today.png"]TransformtoSize:CGSizeMake(28, 28)];
    [tabBarVC addChildViewController:todayNav];
    
    AddEventViewController *addEventVC = [[AddEventViewController alloc]init];
    // 创建按钮
    UINavigationController *addEventNav = [[UINavigationController alloc] initWithRootViewController:addEventVC];
    addEventNav.tabBarItem.image = [[[UIImage imageNamed:@"addevent.png"]TransformtoSize:CGSizeMake(64, 64)]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    [tabBarVC addChildViewController:addEventNav];
    
    MineViewController *mineVC = [[MineViewController alloc]init];
    // 创建按钮
    UINavigationController *mineNav = [[UINavigationController alloc] initWithRootViewController:mineVC];
    mineNav.tabBarItem.title = @"我的";
    mineNav.tabBarItem.image = [[UIImage imageNamed:@"mine.png"]TransformtoSize:CGSizeMake(25, 25)];
    mineNav.tabBarItem.selectedImage = [[UIImage imageNamed:@"mine.png"]TransformtoSize:CGSizeMake(25, 25)];
    [tabBarVC addChildViewController:mineNav];
    tabBarVC.tabBar.tintColor = [UIColor colorWithRed:123/255.0 green:104/255.0 blue:238/255.0 alpha:1];
    tabBarVC.selectedIndex = 0;
    
    UIView *blankView = [[UIView alloc] initWithFrame:CGRectMake(0, -0.5, UIScreen.mainScreen.bounds.size.width, 0.5)];
    blankView.backgroundColor = UIColor.whiteColor;
    [tabBarVC.tabBar addSubview:blankView];
    self.window.rootViewController = tabBarVC;
    
    [self.window makeKeyAndVisible];
}


@end
